﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Packager
{
    public partial class frmSolution : Form
    {
        Solution solution = new Solution();

        public Solution Solution
        {
            get
            {
                return new Solution() { SolutionFile = solution.SolutionFile, SolutionConfig = solution.SolutionConfig };
            }

            set
            {
                txtSolution.Text = value.SolutionFile;
                cbbConfiguration.Text = value.SolutionConfig;
            }
        }

        public frmSolution()
        {
            InitializeComponent();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            solution.SolutionFile = txtSolution.Text;
            solution.SolutionConfig = cbbConfiguration.Text;
        }

        private void txtSolution_Click(object sender, EventArgs e)
        {
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
              txtSolution.Text =  (Properties.Settings.Default.ProjectFolder.Length > 0 && ofd.FileName.Contains(Properties.Settings.Default.ProjectFolder))
                                    ? ofd.FileName.Substring(Properties.Settings.Default.ProjectFolder.Length+1)
                                    : ofd.FileName;
                 ;
            }
        }
    }
}
